package vn.bk.hotel.dialog;

import vn.bk.hotel.R;
import vn.bk.hotel.SearchByLandmark;
import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class ChooseCity {
    private Dialog dialog;

    public ChooseCity(final Context paramContext) {
	this.dialog = new Dialog(paramContext);
	this.dialog.setTitle(paramContext
		.getString(R.string.dialog_choose_city_title));
	View localView = View.inflate(paramContext,
		R.layout.dialog_choose_city, null);
	ListView localListView = (ListView) localView
		.findViewById(R.id.list_city);
	localListView.setAdapter(new ArrayAdapter<String>(paramContext,
		android.R.layout.simple_list_item_1, paramContext
			.getResources().getStringArray(R.array.city_landmark)));
	localListView
		.setOnItemClickListener(new AdapterView.OnItemClickListener() {
		    public void onItemClick(
			    AdapterView<?> paramAnonymousAdapterView,
			    View paramAnonymousView, int paramAnonymousInt,
			    long paramAnonymousLong) {
			String str ;
			switch (paramAnonymousInt) {
			case 0:
			    str = paramContext.getResources().getStringArray(
				    R.array.landmark_hn_text)[0];
			    break;
			case 1:
			    str = paramContext.getResources().getStringArray(
				    R.array.landmark_hcm_text)[0];
			    break;
			case 2:
			    str = paramContext.getResources().getStringArray(
				    R.array.landmark_dn_text)[0];
			    break;
			case 3:
			    str = paramContext.getResources().getStringArray(
				    R.array.landmark_hp_text)[0];
			    break;
			default:
			    str = paramContext.getResources().getStringArray(
				    R.array.landmark_hn_text)[0];
			    break;

			}
			SearchByLandmark.changeCity(paramAnonymousInt, str);
			dialog.dismiss();
		    }
		});
	this.dialog.setContentView(localView);
    }

    public void show() {
	this.dialog.show();
    }
}
